package com.ego.product.feign;

import com.ego.common.util.Result;
import com.ego.common.vo.order.OrderSubmitVo;
import com.ego.common.vo.order.PayAsyncVo;
import com.ego.product.vo.order.WebParamVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * @program: ego
 * @description: 远程调用订单服务
 * @author: KamTang
 * @create: 2022-12-24 10:28
 **/
@FeignClient("ego-order")
public interface OrderFeign {

    /**
     * 提交订单
     * @param submitVo @see
     * @return 提交成功返回订单否则什么都不返回
     * @see OrderSubmitVo
     */
    @PostMapping("/order/submit")
    Result submit(@Valid @RequestBody OrderSubmitVo submitVo);

    /**
     * 根据订单号获取订单的支付信息
     * @param orderSn 订单号
     * @return @see
     * @see Result
     */
    @GetMapping("/order/pay-info/{orderSn}")
    Result getPayInfo(@PathVariable("orderSn") String orderSn);

    /**
     * 根据前端参数分页获取会员订单信息
     * @param param @see WebParamVo
     * @return @see
     * @see Result
     * @see WebParamVo
     */
    @PostMapping("/order/my-order-item")
    Result page(@Valid @RequestBody WebParamVo param);

    /**
     * 处理支付结果
     * @param vo @see
     * @return 结果
     * @see PayAsyncVo
     */
    @PostMapping("/order/handle-pay-result")
    Result handlePayResult(@Valid @RequestBody PayAsyncVo vo);

    /**
     * 根据据订单号获取订单详情
     * @param orderSn 订单号
     * @return @see
     * @see com.ego.common.to.order.OrderDetailTo
     */
    @GetMapping("/order/detail/{orderSn}")
    Result detail(@PathVariable("orderSn") String orderSn);
}
